#ifndef __USART_H
#define __USART_H


#define  USART2_GPIO_CLK        			RCC_AHB1Periph_GPIOA
#define  USART2_USART_CLK        			RCC_APB1Periph_USART2
#define  USART2_GPIO_PORT       			GPIOA
#define  USART2_GPIO_TX_PIN        			GPIO_Pin_2
#define  USART2_GPIO_RX_PIN        			GPIO_Pin_3
#define  USART2_GPIO_TX_PIN_SOURCE        	GPIO_PinSource2
#define  USART2_GPIO_RX_PIN_SOURCE        	GPIO_PinSource3

#define  USART4_GPIO_CLK        			RCC_AHB1Periph_GPIOC
#define  USART4_USART_CLK        			RCC_APB1Periph_UART4
#define  USART4_GPIO_PORT       			GPIOC
#define  USART4_GPIO_TX_PIN        			GPIO_Pin_10
#define  USART4_GPIO_RX_PIN        			GPIO_Pin_11
#define  USART4_GPIO_TX_PIN_SOURCE        	GPIO_PinSource10
#define  USART4_GPIO_RX_PIN_SOURCE        	GPIO_PinSource11

struct usart_packet_t
{
	uint8_t rx_buf[128];
	uint8_t rx_len;
};

extern volatile uint8_t  g_asrpro_rx_buf[128];
extern volatile uint32_t g_asrpro_rx_cnt;


extern void usart1_init(uint32_t baud);
extern void usart2_init(uint32_t baud);
extern void usart3_init(uint32_t baud);
extern void usart4_init(uint32_t baud);

extern void usart2_send_str(char *str);
extern void usart2_send_bytes(uint8_t *buf,uint32_t len);

extern void usart3_send_str(char *str);
extern void usart3_send_bytes(uint8_t *buf,uint32_t len);

extern void usart4_send_str(char *str);
extern void usart4_send_bytes(uint8_t *buf,uint32_t len);



#endif


